package com.masterclient.app.businessmodule.minemodule.message.adapter;

import android.widget.FrameLayout;

import com.bumptech.glide.load.Transformation;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.eoner.baselibrary.bean.personal.OtherMsgItemBean;
import com.eoner.baselibrary.utils.ScreenUtils;
import com.eoner.baselibrary.utils.ViewTransformUtil;
import com.masterclient.app.R;

import jp.wasabeef.glide.transformations.RoundedCornersTransformation;

public class OtherMsgAdapter extends BaseQuickAdapter<OtherMsgItemBean, BaseViewHolder> {

    public OtherMsgAdapter() {
        super(R.layout.item_vip_msg);
    }

    @Override
    protected void convert(BaseViewHolder helper, OtherMsgItemBean item) {
        FrameLayout frameLayout = helper.getView(R.id.item_vip_msg_imglayout);
        frameLayout.getLayoutParams().height = ((int)((ScreenUtils.getScreenWidth()- ScreenUtils.dp2px(32))*136f/343));
        helper.getView(R.id.item_vip_msg_end).getLayoutParams().height = (int)(frameLayout.getLayoutParams().height*67/136f);
        ViewTransformUtil.glideImageView(mContext,item.getImage(),helper.getView(R.id.item_vip_msg_img) ,
                new Transformation[]{new CenterCrop(), new RoundedCornersTransformation(ScreenUtils.dp2px(7), 0, RoundedCornersTransformation.CornerType.TOP)},
                R.mipmap.defaults_1);

        helper.setText(R.id.item_vip_msg_time, item.getCreate_at())
                .setText(R.id.item_vip_msg_title,item.getTitle())
                .setText(R.id.item_vip_msg_desc, item.getMessage())
                .setTextColor(R.id.item_vip_msg_desc, 0xFF525866)
                .setTextColor(R.id.item_vip_msg_title,0xFF141922)
                .setGone(R.id.item_vip_msg_bg, false)
                .setGone(R.id.item_vip_msg_end, false);
    }
}
